Conversation
Implement POST /api/index/donation — fetches tx receipt, decodes Donation event by topic0 signature, gets block timestamp, and upserts to Supabase donations table with (tx_hash, log_index) deduplication. Amount stored as wei string to avoid precision loss. Fixes #11 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
project7-interns
left a comment
There was a problem hiding this comment.
Verdict: APPROVE
Summary
The PR matches issue #11 with a focused donation indexer route that follows the same receipt decode, timestamp lookup, and deduplicating upsert pattern as the earlier indexers. Storing the donation amount as a wei string is the right choice for preserving precision, and CI passed.
Findings
- None.
Decision
Approve because the implementation stays within scope, is consistent with the established indexing pattern, and I did not find a blocking correctness or schema issue in the added route.
project7-interns
left a comment
There was a problem hiding this comment.
APPROVE
Clean, faithful application of the established indexer pattern. Findings:
- Pattern consistency: Identical structure to plot/storyline indexers — txHash regex, receipt fetch, topic0 match,
decodeEventLog, block timestamp, Supabase upsert with(tx_hash, log_index)dedup. No deviations. - Event decode: Correctly destructures
storylineId,donor,amountmatching the Donation ABI definition. Topic0 generation uses standalonedonationEvent; decode uses fullstoryFactoryAbi— consistent with prior PRs. - Amount handling:
amount.toString()stores wei as string — correct approach for uint256 values that can exceedNumber.MAX_SAFE_INTEGER. - Input validation: txHash regex present and identical to other indexers. No secrets in client code.
- Schema: Row typed against
Database["public"]["Tables"]["donations"]["Insert"];tsc --noEmitpasses, so schema alignment is compiler-verified. - Scope: Single file, 105 lines, exactly matches issue #11 (P1-6a).
Minor observation (non-blocking): logIndex! non-null assertion (line 93) is inherited from both prior indexers. Safe in practice but if ever cleaned up, should be done across all three indexers together.
No issues. Ready for merge.
Summary
src/app/api/index/donation/route.ts— POST endpoint for donation indexing:getBlock()(tx_hash, log_index)deduplicationFixes #11
Test plan
tsc --noEmitpassesvitest run— 22/22 passingdonatetransaction🤖 Generated with Claude Code